#include <iostream>
#include <stdio.h>
#include <cmath>
#include <iomanip>
using namespace std;

class Point
{
private:
    double x, y;

public:
    Point()
    {
        x = 0;
        y = 0;
        cout << "Constructor." << endl;
    }
    ~Point()
    {
        cout << "Distructor." << endl;
    }
    Point(double x_value, double y_value)
    {
        x = x_value;
        y = y_value;
    }
    double getX()
    {
        return x;
    }
    double getY()
    {
        return y;
    }
    void setXY(double x_value, double y_value)
    {
        x = x_value;
        y = y_value;
    }
    void setX(double x_value)
    {
        x = x_value;
    }
    void setY(double y_value)
    {
        y = y_value;
    }
    double distance(Point &p)
    {
        return sqrt((x - p.getX()) * (x - p.getX()) + (y - p.getY()) * (y - p.getY()));
    }
};

int main()
{
    int t;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;
        Point *p = new Point[n];
        for (int i = 0; i < n; i++)
        {
            double x, y;
            cin >> x >> y;
            p[i].setXY(x, y);
        }
        double max = 0;
        int imax = 0, jmax = 0;
        for (int i = 0; i < n; i++)
        {
            for (int j = i + 1; j < n; j++)
            {
                double d = p[i].distance(p[j]);
                if (d > max)
                {
                    max = d;
                    imax = i;
                    jmax = j;
                }
            }
        }
        cout << "The longeset distance is " << fixed << setprecision(2) << max;
        printf(",between p[%d] and p[%d].\n", imax, jmax);
        delete[] p;
    }

    return 0;
}

/*

*/